package com.molichuxing.services.property;

/**
 * @Author: renzhengyu
 * @Description:
 * @Date: Created in 11:14 2019/8/27
 * @Modified By:
 **/
public enum OrderDealerCarLockEnum {
    /**
     * 已锁定
     */
    LOCK(0, "已锁定"),

    /**
     * 未锁定
     */
    ON_LOCK(1,"未锁定");

    int value;
    String name;

    OrderDealerCarLockEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        OrderDealerCarLockEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static OrderDealerCarLockEnum getEnum(int value) {
        for (OrderDealerCarLockEnum enumerate : OrderDealerCarLockEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
